package com.magenta.maxoptra.gis;

import com.magenta.maxoptra.gis.distancematrix.Command;

import java.util.List;

/**
 * @author Sergey Grachev
 */
public interface DistanceMatrixService {

    void start();

    void stop();

    /**
     * @see DistanceMatrixService#scheduleForExecute(java.util.List, boolean)
     */
    void scheduleForExecute(List<Command> commands);

    /**
     * Schedule commands for executing
     * <p/>
     * Commands can be reordered, ex.
     * <p/>
     * ORIGINAL:<pre>
     *  1  start 1
     *  2  stop 1
     *  3  synchronize matrices 1
     *  4  synchronize matrices 2
     *  5  synchronize matrices 1
     *  6  synchronize matrices 2
     *  7  update geo provider settings 1
     *  8  update requests interval 1
     * </pre><p/>
     * REORDERED:<pre>
     *  2  stop 1
     *  7  update geo provider settings 1
     *  8  update requests interval 1
     *  3  synchronize matrices 1
     *  5  synchronize matrices 1
     *  4  synchronize matrices 2
     *  6  synchronize matrices 2
     *  1  start 1
     * </pre>
     *
     * @param commands        list of command for execution
     * @param reorderCommands reorder or not commands before execution (see above)
     */
    void scheduleForExecute(List<Command> commands, boolean reorderCommands);

    /**
     * @see DistanceMatrixService#scheduleForExecute(java.util.List, boolean)
     */
    void scheduleForExecute(Command command);
}
